package com.blb.edupayservice.service;

import com.google.zxing.WriterException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

public interface WxPayService {

    /**
     * 购买课程
     * @param userId 用户id
     * @param courseId 课程id
     * @param price 价格
     * @return
     */
    Map<String, String> makeOrder(Long userId, Long courseId, Long price) throws Exception;

    /**
     * 生成二维码
     * @param codeUrl
     * @param response
     */
    void makeQRCode(String codeUrl, HttpServletResponse response) throws Exception;

    /**
     * 检查支付状态
     */
    String checkOrder(String tradeNo) throws Exception;

    /**
     * 支付回调
     * @param request
     * @param response
     */
    void payCallback(HttpServletRequest request,HttpServletResponse response) throws Exception;

    /**
     * 取消订单
     * @param tradeNo
     */
    void cancelOrder(String tradeNo);
}
